// pages/index1/index1.js

const app = getApp()
const pathUrl = app.globalData.pathUrl;

Page({

  /**
   * 页面的初始数据
   */
  data: {
    sfsm:false,
    userInfo:'',
    userId:'',
    telphone:'',
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    var userInfo = wx.getStorageSync('userInfo');
    var userId = wx.getStorageSync('userId');
    var telphone = wx.getStorageSync('telphone');
    var sfsm = wx.getStorageSync('sfsm');
    var orderNo = wx.getStorageSync('orderNo');
    var realName = wx.getStorageSync('realName');

    console.log(sfsm)
    that.setData({
      userId: userId,
      telphone: telphone,
      sfsm: sfsm,
      orderNo: orderNo,
      realName: realName

    })
    if (sfsm == '已实名') {
      that.setData({
        userInfo: userInfo,
        sfsm: true
      })
    } else {
    //  wx.navigateTo({
    //    url: '/pages/login/login',
    //  })
    }
    this.getlist02();
  },
  getlist02:function(){
    var that =this;
    wx.request({
      url: pathUrl + '/gzgl/fxyGzgl02/list',
      data:{
        query07:that.data.orderNo
      },
      method:'GET',
      success:function(e){
        console.log(e)
        console.log(e.data.result.records)
        that.setData({
          list02: e.data.result.records
        })
      }
    })
  },
  goSign:function(e){
    console.log(e)
    var that = this;
    var realName =that.data.realName;
    var name = e.currentTarget.dataset.realname;
    if(name == realName){
      wx.navigateTo({
        url: '../notificationbook/notificationbook'
      })
    }else{
      wx.showModal({
        title: '提示',
        content: '对不起您不是该用户，没有权限操作',
        showCancel:false
      })
    }
   
  },
  realname: function () {
    wx.navigateTo({
      url: '../realname/realname'
    })
  },
  pay: function () {
    wx.navigateTo({
      url: '/pages/pay/pay',
    })
  },
  companyApprove: function () {
    wx.navigateTo({
      url: '../companyApprove/companyApprove',
    })
  },
  companyValidation: function () {
    wx.navigateTo({
      url: '../companyValidation/companyValidation',
    })
  },
  resultCheck: function () {
    wx.navigateTo({
      url: '../resultCheck/resultCheck'
    })
  },
  code: function () {
    wx.navigateTo({
      url: '../code/code'
    })
  },
  onShareAppMessage: function (res) {
    return {
      title: '哈根达斯冰激凌5折特惠',
      path: '/pages/index/index?goods_id=' + wx.getStorageSync("goods_id"),
      imageUrl: 'http://static.e-mallchina.com/pic/product/brand/detail/hgds.jpg'//自定义图片路径，可以是本地文件路径、代码包文件路径或者网络图片路径。支持PNG及JPG。显示图片长宽比是 5:4。
    }
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})